package fallon;

import com.adxon.MsgException;
import com.adxon.data.Link;
import com.adxon.data.Mark;
import com.adxon.data.Item;
import com.adxon.data.User;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class SetupServlet extends HttpServlet{
	public void doGet(HttpServletRequest req,HttpServletResponse resp)
			throws IOException, ServletException{
		/*byte[] b={
			-1,-40,-1,-32,0,16,74,70,73,70,0,1,2,0,0,1,0,1,0,0,-1,-37,0,67,0,8,
			6,6,7,6,5,8,7,7,7,9,9,8,10,12,20,13,12,11,11,12,25,18,19,15,20,29,
			26,31,30,29,26,28,28,32,36,46,39,32,34,44,35,28,28,40,55,41,44,48,
			49,52,52,52,31,39,57,61,56,50,60,46,51,52,50,-1,-37,0,67,1,9,9,9,
			12,11,12,24,13,13,24,50,33,28,33,50,50,50,50,50,50,50,50,50,50,50,
			50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
			50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,-1,-64,0,17,8,0,
			96,0,96,3,1,34,0,2,17,1,3,17,1,-1,-60,0,31,0,0,1,5,1,1,1,1,1,1,0,0,
			0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,16,0,2,1,3,3,2,4,
			3,5,5,4,4,0,0,1,125,1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,
			20,50,-127,-111,-95,8,35,66,-79,-63,21,82,-47,-16,36,51,98,114,
			-126,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,
			68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,
			104,105,106,115,116,117,118,119,120,121,122,-125,-124,-123,-122,
			-121,-120,-119,-118,-110,-109,-108,-107,-106,-105,-104,-103,-102,
			-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,
			-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45,-44,-43,-42,
			-41,-40,-39,-38,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-15,-14,
			-13,-12,-11,-10,-9,-8,-7,-6,-1,-60,0,31,1,0,3,1,1,1,1,1,1,1,1,1,0,
			0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,17,0,2,1,2,4,4,3,4,
			7,5,4,4,0,1,2,119,0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,
			50,-127,8,20,66,-111,-95,-79,-63,9,35,51,82,-16,21,98,114,-47,10,
			22,36,52,-31,37,-15,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,
			67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,
			104,105,106,115,116,117,118,119,120,121,122,-126,-125,-124,-123,
			-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105,-104,-103,
			-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,
			-72,-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45,-44,-43,
			-42,-41,-40,-39,-38,-30,-29,-28,-27,-26,-25,-24,-23,-22,-14,-13,
			-12,-11,-10,-9,-8,-7,-6,-1,-38,0,12,3,1,0,2,17,3,17,0,63,0,-9,-6,
			40,-88,-27,-106,56,34,105,101,117,72,-44,101,-103,-114,0,20,1,37,
			100,106,-2,32,-45,116,88,-13,119,62,36,35,43,18,114,-19,-8,127,
			-115,113,-6,-17,-60,55,99,45,-74,-109,24,85,-24,46,-104,-28,-97,-9,
			87,28,125,79,-27,92,28,-78,-55,60,-83,44,-82,-46,72,-57,44,-52,114,
			77,75,-105,98,-44,59,-99,-67,-9,-60,-101,-90,96,44,44,-29,-119,127,
			-67,49,-36,79,-32,48,5,83,-117,-30,54,-76,-121,-25,75,73,6,123,-58,
			71,-14,53,-56,-47,83,118,95,42,61,71,72,-8,-121,101,121,42,-61,127,
			9,-76,118,-32,62,-19,-55,-97,115,-38,-69,36,117,-111,3,35,6,82,50,
			8,57,4,87,-49,-107,-46,120,111,-59,-9,26,10,-68,15,17,-71,-75,98,8,
			-116,-66,10,30,-27,120,63,-107,53,46,-28,-54,29,-113,98,-94,-77,
			-76,-99,102,-53,90,-75,19,-39,-54,27,-77,-95,-31,-112,-6,17,90,53,
			102,97,69,20,80,2,87,1,-15,39,82,120,-32,-75,-45,-93,-109,2,92,-55,
			50,-114,-32,125,-33,-61,57,-4,-85,-48,43,-60,-68,81,124,-6,-121,
			-119,47,102,110,-119,33,-119,71,-5,43,-59,76,-98,-123,-63,93,-104,
			-44,81,91,-106,-66,30,-110,-21,-61,-53,-86,-58,92,-127,115,-28,-56,
			-72,-24,-100,13,-61,-15,53,6,-83,-40,-61,-94,-76,53,-53,56,-84,53,
			-53,-37,88,84,-84,81,74,85,1,57,-30,-77,-24,0,-94,-118,40,3,67,71,
			-43,-18,116,93,65,47,32,110,-100,58,118,117,-18,13,123,85,-123,-12,
			58,-107,-116,55,118,-25,49,-54,-95,-121,-73,-73,-44,87,-126,-41,
			-96,124,55,-43,-56,121,-12,-87,27,-125,-5,-40,65,-1,0,-57,-121,-14,
			63,-99,84,89,19,93,79,70,-94,-118,42,-52,-118,-102,-115,-40,-79,
			-45,110,110,-56,-56,-122,54,124,122,-32,87,-125,59,-103,29,-99,-66,
			-13,18,-57,-22,107,-34,-17,-32,23,58,125,-52,45,-46,72,-103,127,49,
			94,7,-116,28,30,-36,84,72,-46,-103,-34,124,58,-46,124,-13,121,-88,
			74,-86,-47,-19,-14,16,50,-25,39,-87,63,-54,-69,109,27,73,-113,72,
			-46,98,-79,86,-13,21,50,75,21,-58,-30,78,122,85,15,6,44,9,-31,123,
			53,-126,68,114,20,-105,-38,115,-122,39,36,31,122,-53,-15,127,-118,
			-75,29,30,97,109,105,106,35,14,62,91,-119,8,108,-1,0,-70,-65,-44,
			-45,86,72,78,-14,118,40,-4,67,-75,-126,5,19,-18,69,-106,-27,-109,
			42,87,-26,37,65,5,-127,-12,0,-128,126,-94,-72,107,-26,-74,105,-105,
			-20,-61,-28,8,1,61,50,107,99,78,-46,-11,31,23,-51,121,59,-34,23,
			-98,4,13,-5,-34,119,103,56,81,-23,-48,-42,1,66,31,99,2,-84,14,8,35,
			-95,-88,125,-51,35,-94,-80,-38,42,-43,-64,-77,72,2,68,-77,-103,-13,
			-13,59,-31,71,-45,21,86,-127,-123,111,120,54,65,23,-117,44,9,-49,
			46,87,-13,82,43,6,-74,60,47,-97,-8,73,-12,-36,127,-49,117,-95,9,
			-20,123,109,45,20,86,-90,3,88,110,82,15,126,43,-59,60,71,-95,-53,
			-95,106,-113,3,101,-96,124,-68,50,127,121,127,-60,87,-74,-10,-84,
			47,18,120,118,15,17,89,-84,110,-26,41,-94,36,-59,32,25,-37,-98,-96,
			-114,-32,-32,84,-75,114,-94,-20,-54,26,94,116,-113,7,-38,75,-90,88,
			9,-82,103,-115,62,68,24,-36,-20,62,-13,31,65,92,-82,-89,-31,31,18,
			-34,-76,-6,-123,-23,-118,105,-79,-110,-86,-7,102,30,-118,0,-57,-31,
			93,-33,-123,-20,47,116,-51,18,59,59,-26,67,36,78,-63,10,28,-115,
			-103,-30,-76,-81,111,33,-80,-77,-106,-18,-31,-74,-61,18,-18,99,
			-116,-15,69,-126,-10,122,24,94,13,-48,27,67,-46,-53,78,49,119,113,
			-122,-108,127,116,14,-117,-8,100,-2,117,-58,106,-117,103,-89,-8,
			-34,-8,-35,-58,85,89,-61,-60,-60,124,-96,-112,14,113,-7,-13,93,111,
			-4,44,45,11,-54,15,-66,-29,113,-2,15,40,-28,127,74,-32,-4,83,-30,8,
			-68,65,123,20,-47,-38,-104,68,74,80,49,108,-77,-116,-28,103,-45,
			-11,-87,-107,-83,98,-93,123,-35,-99,20,-42,-10,-41,-16,21,-111,82,
			68,110,-116,63,-104,53,-57,106,-74,86,-10,87,2,56,46,4,-67,119,47,
			116,-10,53,94,-39,-27,-13,86,56,-26,104,-73,-99,-92,-122,32,84,78,
			0,118,0,-28,3,-116,-6,-44,37,99,81,-75,-48,120,38,63,55,-59,-106,
			64,-82,66,-106,111,-90,20,-41,63,94,-117,-16,-13,67,120,-107,-75,
			121,-72,18,41,72,84,-114,-39,-27,-65,-91,90,-36,-119,59,35,-48,69,
			20,81,90,24,-123,20,81,64,5,49,-47,100,70,71,80,-54,-61,5,72,-56,
			34,-97,65,-96,14,98,-13,-63,26,5,-61,52,-115,106,96,-18,76,82,21,3,
			-16,-24,43,-126,-44,-41,-61,22,-38,-125,65,111,21,-12,-48,-89,13,
			44,115,-116,19,-19,-111,-56,-9,-82,-57,82,-47,53,-81,18,94,-54,
			-105,-105,31,96,-45,-93,98,-79,-58,-121,115,72,63,-68,112,113,-37,
			-67,97,-8,-109,65,-48,-4,55,-90,4,11,45,-51,-12,-32,-120,-116,-110,
			16,23,-43,-80,61,42,25,-92,89,-57,93,-101,102,-72,99,102,-110,-84,
			28,109,19,48,102,-4,72,-88,104,-94,-92,-48,-98,-50,-36,-35,-34,67,
			110,58,-53,34,-89,-26,113,94,-11,4,49,-37,-62,-112,-60,-95,99,69,
			10,-86,59,1,94,13,99,63,-39,-81,96,-97,56,-14,-28,87,-49,-48,-26,
			-67,-18,55,89,17,93,14,85,-122,65,-11,21,81,51,-104,-6,40,-94,-84,
			-52,40,-94,-118,0,74,43,30,-5,-60,-6,62,-97,35,69,115,127,18,-56,
			58,-94,-27,-120,-4,-85,61,124,125,-95,57,96,37,-101,112,-5,-85,-28,
			-100,-71,-10,-91,113,-39,-99,51,50,-94,-106,98,0,29,73,-82,79,-60,
			-41,126,20,-71,84,-2,-45,-99,38,-106,48,66,8,28,-77,-116,-1,0,-69,
			-3,107,35,-30,19,-33,75,99,-89,-55,36,79,20,36,-71,117,82,72,92,
			-19,-38,27,-33,-81,-75,121,-1,0,74,-106,-6,23,24,-11,31,55,-105,
			-25,-55,-28,-18,-14,-73,29,-101,-70,-19,-49,25,-90,81,69,73,-96,87,
			-87,120,55,-59,118,-105,118,118,-6,109,-52,-98,93,-36,72,35,82,-25,
			-119,64,-23,-125,-21,-19,94,91,90,-70,54,-99,111,117,50,79,125,119,
			21,-83,-102,72,-86,-52,-57,-26,115,-41,106,-127,-49,-29,-48,83,78,
			-60,-55,93,30,-29,69,49,2,-124,80,-65,116,12,14,123,83,-21,67,19,
			-1,-39,
		};
		try{
			resp.setContentType("text/plain");

			User hans=new User();
			hans.setAccount("webmaster@adxon.com");
			hans.setPermaLink("webmaster");
			hans.setRate(10);
			hans.setText("Webmaster");
			hans.commit();

			hans=new User();
			hans.setAccount("sologram@gmail.com");
			hans.setPermaLink("hans");
			hans.setNewPass("1234567890");
			hans.setRate(10);
			hans.setText("Hans");
			hans.setDescription("Hello, world!");
			hans.commit();

			User benny=new User();
			benny.setAccount("wghwork@gmail.com");
			benny.setNewPass("1234567890");
			benny.setRate(10);
			benny.setText("Benny");
			benny.setBits(b);
			benny.commit();

			User yiwen=new User();
			yiwen.setAccount("omg.xxnobody@gmail.com");
			yiwen.setPermaLink("yiwen");
			yiwen.setNewPass("1234567890");
			yiwen.setRate(10);
			yiwen.setText("Yiwen");
			yiwen.commit();

			User lee=new User();
			lee.setAccount("lee");
			lee.setRate(10);
			lee.setText("李文杰");
			lee.commit();

			Link n=new Link();
			n.setDescription("牛顿的伟大似乎已毋庸置疑，有人认为，如果当时有诺贝尔奖，那么牛顿至少能得三次：万有引力定律、光学和化学的贡献，另外由于他在微积分上的造诣，还能得一次菲尔兹奖，但事实果真如此吗?");
			n.setPermaLink("http://www.douban.com/group/topic/55023818/");
			n.setOwner(lee);
			n.setTags("牛顿,科学,人物,胡克,莱布尼茨,哈雷");
			n.setText("牛顿的另一面：卑鄙的天才 无德的科学家");
			n.addRef();
			n.commit();
			Mark m=new Mark();
			m.setRef(n);
			m.setOwner(lee);
			m.commit();

			n=new Link();
			n.setDescription("世界又不认识你，它是无意的。");
			n.setPermaLink("http://www.zhihu.com/question/23474904/answer/25122270");
			n.setOwner(yiwen);
			n.setText("世界是善意的吗?");
			n.addRef();
			n.commit();
			m=new Mark();
			m.setRef(n);
			m.setOwner(yiwen);
			m.commit();

			n=new Link();
			n.setDescription("研究哲学有什么“具体实际的意义”很难证明，但据我所知学习哲学最“具体实际的意义”，是补贴其它学科的教学费用。见：人文学科和其他学科：是谁补助了谁?摘一段：在所有专业中，工程专业最为昂贵：培养一名本科学生需要接近十万美元。");
			n.setPermaLink("http://www.zhihu.com/question/24115224/answer/26868346");
			n.setOwner(benny);
			n.setTags("哲学,教育,文科,理科");
			n.setText("研究哲学的具体实际的意义是什么?");
			n.addRef();
			n.commit();
			m=new Mark();
			m.setRef(n);
			m.setOwner(benny);
			m.commit();

			n=new Link();
			n.setDescription("人们一度认为，围棋是如此复杂，可能真的需要通过细究人是如何理解围棋，然后模拟人的思维，然后才能够战胜人类，或者至少成为一个可以认真对待的对手。围棋中的“筋”、“形”、“厚实”、“薄味”，入界宜缓、弃子争先，这些概念，如何能够在程序中体现？这似乎是需要一个崭新的做法。为数不多的电脑围棋开发者在这条路上徘徊了几年。然后，新的做法果然出现了，但却跟“理解围棋”没什么太大关系。");
			n.setPermaLink("http://www.zhihu.com/question/21714457/answer/26815691");
			n.setOwner(benny);
			n.setTags("象棋,围棋,智能,算法,人工,机器");
			n.setText("在国际象棋领域，电脑已经可以战胜人脑，那么围棋领域电脑还差多远?");
			n.addRef();
			n.commit();
			m=new Mark();
			m.setRef(n);
			m.setOwner(benny);
			m.commit();

			n=(Link)new Link().update("http://www.zhihu.com/question/23474904/answer/25122270");
			n.addRef();
			n.commit();
			m=new Mark();
			m.setRef(n);
			m.setOwner(hans);
			m.setTags("世界,哲学");
			m.commit();

			n=new Link();
			n.setPermaLink("http://www.zhihu.com/question/19617804");
			n.setOwner(lee);
			n.setTags("字体,渲染,字符,编码,特殊");
			n.setText("“I think there's a smudge on.̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̸̨̨̨̨̨̨̨̨̨̨̨̨.̸̸̨̨your screen”这种文本究竟是怎么回事?");
			n.addRef();
			n.commit();
			m=new Mark();
			m.setRef(n);
			m.setOwner(lee);
			m.commit();

			Item p=new Item();
			p.setDescription("因为矛盾对立统一不是定律。");
			p.setOwner(yiwen);
			p.setTags("哲学,科学,定律");
			p.setText("热力学第二定律与矛盾对立统一定律两者相悖，怎么解释?");
			p.commit();

			n=new Link();
			n.setDescription("正如这里的热门回答所说，指望哲学论证有可能像数学一样精确显然是天方夜谭。更加一般地，想要给自己寻找不能干某事的原因，千千万万都能找到。但这不等于说“通常属于哲学范畴”的问题得不到精确的回答。意义学在一个只有六条简单公理的紧凑理论框架体系中已经或者将能完全在公认的科学范畴内精确解决通常属于哲学范畴的问题中常见和重要的部分，完全不需要回避现实的验证与核查。");
			n.setPermaLink("http://www.zhihu.com/question/20841131/answer/22297874");
			n.setOwner(hans);
			n.setTags("哲学,数学,精确,理论");
			n.setText("哲学论证有可能像数学一样精确吗?");
			n.addRef();
			n.commit();
			m=new Mark();
			m.setRef(n);
			m.setOwner(hans);
			m.commit();

			n=(Link)new Link().update("http://www.douban.com/group/topic/55023818/");
			n.addRef();
			n.commit();
			m=new Mark();
			m.setRef(n);
			m.setOwner(yiwen);
			m.setTags("数学,牛顿,历史,科学,人物");
			m.setDescription("牛顿最重要的贡献就是发现了万有引力定律，但这并非牛顿一个人的功劳。胡克早于牛顿发现了“引力大小与距离的平方成反比”现象，而当时牛顿甚至错误的认为引力大小不随距离变化，胡克之后将自己的发现和感想在信中与牛顿进行了讨论，并纠正了后者的错误概念。");
			m.commit();

			n=new Link();
			n.setPermaLink("http://www.zhihu.com/question/24338193");
			n.setOwner(benny);
			n.setTags("生鲜,电商");
			n.setText("生鲜电商有成功案例吗?");
			n.addRef();
			n.commit();
			m=new Mark();
			m.setRef(n);
			m.setOwner(benny);
			m.commit();

			n=(Link)new Link().update("http://www.douban.com/group/topic/55023818/");
			n.addRef();
			n.commit();
			m=new Mark();
			m.setRef(n);
			m.setOwner(hans);
			n.setTags("牛顿,历史,科学,人物");
			m.commit();

			n=(Link)new Link().update("http://www.zhihu.com/question/24338193");
			n.addRef();
			n.commit();
			m=new Mark();
			m.setRef(n);
			m.setOwner(lee);
			m.commit();

			n=(Link)new Link().update("http://www.douban.com/group/topic/55023818/");
			n.addRef();
			n.commit();
			m=new Mark();
			m.setRef(n);
			m.setOwner(benny);
			m.commit();

			System.out.println("SetupServlet");
			resp.sendRedirect("/");
		}catch(MsgException x){
			resp.getWriter().println(x.getMessage());
		}*/
	}
}